from django.test import TestCase

# Create your tests here.

# import requests
#
# for i in range(1, 10000):
#     response = requests.get('http://47.103.140.217/docker/').text
#     print(response)


# import redis
# from redis.sentinel import Sentinel
#
# # 连接哨兵服务器(主机名也可以用域名)
# # 47.103.140.217
# sentinel = Sentinel([('47.103.140.217', 26379),
#                      ('47.103.140.217', 26378),
#                      ('47.103.140.217', 26377)
#                      ],
#                     socket_timeout=5)
#
# print(sentinel)
# # 获取主服务器地址
# master = sentinel.discover_master('mymaster')
# print(master)
# #
# # 获取从服务器地址
# slave = sentinel.discover_slaves('mymaster')
# print(slave)
#
# master = sentinel.master_for('mymaster', socket_timeout=1)
# w_ret = master.set('name','master_randy')
#
#
# #
# slave = sentinel.slave_for('mymaster', socket_timeout=0.5)
# r_ret = slave.get('name')
# print(r_ret)


# import redis
# pool = redis.ConnectionPool(host='47.103.140.217', port=6378, db=10, max_connections=100)
# r = redis.Redis(connection_pool=pool)
# # print(r.set('age', 18))
# print(r.get('age'))